home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-02 | 2.4 KB | 77 lines | [TEXT/GEOL] |
- Item 8593117 26-Feb-90 11:05PST
-
- From: AU0008 Austria - Kopfwerk,IDV
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Header Printing
-
- Dear colleagues,
-
- I have problems with printing of headers and footers. I want to print a
- TGridView like the Calc example but with a header on top of each page.
-
- Here is the way I solved it (if you think it is bad, please don´t be afraid to
- link me…): I overrode TStdPrintHandler to handle 2 views - the normal view
- (passed in IStdPrintHandler) and the header view (will be printed in
- AdornPage).
-
- TSpecPrintHandler = OJBECT(TStdPrintHandler)
- fHeaderView : TView;
- PROCEDURE TSpecPrintHandler.ISpecPrinthandler (itsDocument: TDocument;
- MainView, HeaderView: TView);
- PROCEDURE TSpecPrintHandler.AdornPage; OVERRIDE;
- PROCEDURE TSpecPrintHandler.FocusOnBorder; OVERRIDE;
- PROCEDURE TSpecPrintHandler.FocusOnInterior; OVERRIDE;
- END;
-
- PROCEDURE TSpecPrintHandler.ISpecPrinthandler (itsDocument: TDocument;
- MainView, HeaderView: TView);
- VAR
- aRect : RECT;
- BEGIN
- fHeaderView:= NIL;
- IStdPrintHandler (itsDocument, MainView, FALSE, TRUE, TRUE);
- fHeaderView:= HeaderView;
-
- InstallMargins (aRect, TRUE); { set drawing area to maximum }
- aRect:= fPageAreas.theMargins;
- aRect.top:= aRect.top + 14; { reserve room for header }
- InstallMargins (aRect, FALSE);
- END;
-
- PROCEDURE TSpecPrintHandler.AdornPage; OVERRIDE;
- BEGIN
- INHERITED AdornPage; { draw frames in debugging mode }
- fHeaderView.DrawContents; { please draw my header }
- END;
-
- Normaly during start of printing focusing occurs for the mainview. We print now
- alternately 2 views so focusing is neccessary.
-
- PROCEDURE TSpecPrintHandler.FocusOnBorder; OVERRIDE;
- BEGIN
- IF fHeaderView.Focus THEN ;
- INHERITED FocusOnBorder; { not real focus, just offsetcalculation }
- END;
-
-
- PROCEDURE TSpecPrintHandler.FocusOnInterior; OVERRIDE;
- BEGIN
- IF fView.Focus THEN ;
- INHERITED FocusOnInterior; { not real focus, just offsetcalculation }
- END;
-
- My way has problems and limitations:
- 1. sometimes there is no mainview on the LW output, but you can see it with
- "Preview".
- 2. You have always the same header, also when horizontal breaks occur.
-
- Maybe this is a wrong way, but it seems easy to me. I have not to worry about
- CalcPageStrips etc.
-
- Thank you in advance,
- Tommi
- KOPFWERK SW Dev.
-
-